package com.iis.hrms.persistence;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * The persistent class for the history_absensi database table.
 */
@Entity
@Table(name = "history_absensi")
@NamedQueries({
        @NamedQuery(name = "HistoryAbsensi.findAll", query = "SELECT h FROM HistoryAbsensi h"),
        @NamedQuery(name = "HistoryAbsensi.findById", query = "SELECT h FROM HistoryAbsensi h WHERE h.id = :id"),
        @NamedQuery(name = "HistoryAbsensi.findByStartDate", query = "SELECT h FROM HistoryAbsensi h WHERE h.startDate = :startDate"),
        @NamedQuery(name = "HistoryAbsensi.findByEndDate", query = "SELECT h FROM HistoryAbsensi h WHERE h.endDate = :endDate"),
        @NamedQuery(name = "HistoryAbsensi.findByDescription", query = "SELECT h FROM HistoryAbsensi h WHERE h.description = :description")})
public class HistoryAbsensi implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(unique = true, nullable = false)
    private String id;

    @Column(nullable = false, length = 1)
    private String description;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "end_date", nullable = false)
    private Date endDate;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "start_date", nullable = false)
    private Date startDate;

    // bi-directional many-to-one association to Employee
    @ManyToOne
    @JoinColumn(name = "id_employee", nullable = false)
    private Employee employee;

    // bi-directional many-to-one association to HistoryLembur
    @OneToMany(mappedBy = "historyAbsensi")
    private List<HistoryLembur> historyLemburs;

    public HistoryAbsensi() {
    }

    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getEndDate() {
        return this.endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public Date getStartDate() {
        return this.startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Employee getEmployee() {
        return this.employee;
    }

    public void setEmployee(Employee employee) {
        this.employee = employee;
    }

    public List<HistoryLembur> getHistoryLemburs() {
        return this.historyLemburs;
    }

    public void setHistoryLemburs(List<HistoryLembur> historyLemburs) {
        this.historyLemburs = historyLemburs;
    }

}